/**
 * Bakalarska prace - Inteligentni budik
 * @package sleepCatcher
 * @file DataCollector.h
 * @author Jan Pesava - xpesav00
 * @email xpesav00@stud.fit.vutbr.cz
 * @date 24. 12. 2011
 */

#ifndef SCDATACOLLECTOR_H_
#define SCDATACOLLECTOR_H_

#include <FBase.h>
#include <FUi.h>

#include "models/SCSample.h"
#include "models/SCAlarm.h"
#include "models/SCSession.h"

using namespace Osp::Base;
using namespace Osp::Base::Collection;
using namespace Osp::Base::Runtime;
using namespace Osp::Ui::Controls;


class SCDataCollector : public SCBaseObject,
		public Osp::Base::Runtime::ITimerEventListener
{

// Constructor
public:
	SCDataCollector();
	SCDataCollector(Form* pForm);
	virtual ~SCDataCollector();
	result Construct();

// Constants
public:

// Attributes
private:
	SCSession* pSession;
	SCAlarm* pAlarm;
	Timer* pPartTimer;
	Timer* pAlarmTimer;
	Form* pCurrentForm;
	ArrayList* pRemPoints;
	bool isEndAlarmTimer;

// Methods
public:
	void SetSession(SCSession* pSession);
	SCSession* GetSession();
	void SetAlarm(SCAlarm* pAlarm);
	SCAlarm* GetAlarm();
	void SetPartTimer(Timer* pTimer);
	Timer* GetPartTimer();
	void SetAlarmTimer(Timer* pTimer);
	Timer* GetAlarmTimer();
	void SetCurrentForm(Form* pForm);
	Form* GetCurrentForm();

	void StartCatch();
	void StopCatch();
	void AddSample(SCSample *pSample);
	void AddSample(float xAxis, float yAxis, float zAxis);
	void OnTimerExpired (Timer &timer);
	void SetStartPartTimer();
	void SetNextPartTimer();
	void SetStartAlarmTimer();
	void SetEndAlarmTimer();
	void ClearPartData();
	void AlarmRing();
	void ComputeStats();
	long long GetTimeDifference(TimeSpan timeFrom, TimeSpan timeTo);
	DateTime GetCurrentDateTime();
};

#endif /* SCDATACOLLECTOR_H_ */
